#include "main/utils.h"
using namespace std;

class Solution {
public:
    vector<vector<int>> matrixReshape(vector<vector<int>>& mat, int r, int c) {
      vector<vector<int>> ret(r, vector<int>(c));
      int row = mat.size();
      int col = mat[0].size();
      if (row * col != r * c)
        return mat;
      for (int i = 0; i < row * col; ++i) {
        ret[i / c][i % c] = mat[i / col][i % col];
      }
      return ret;
    }
};

int main() {
  vector<vector<int>> mat = {{1, 2}, {3, 4}};
  int r = 1, c = 4;
  Solution su;
  auto ret = su.matrixReshape(mat, r, c);
  printVec("leetcode566", ret);

  return 0;
}
